package com.zds.support.gilde

import android.content.Context
import android.graphics.Bitmap
import android.graphics.drawable.Drawable
import android.widget.ImageView
import androidx.annotation.DrawableRes

interface ImageLoaderStrategy {
    fun init(context: Context)
    fun getBitmap(path: String, onGetBitmapListener: (bitmap: Bitmap) -> Unit)

    fun getDrawable(path: String, onGetDrawableListener: (drawable: Drawable) -> Unit)

    /**
     * 获取图片同步
     */
    fun getBitmapSync(path: String): Bitmap

    fun cleanMemory(context: Context)
    fun load(path: String)

    /**
     * 显示图片
     *
     * @param imageView 图片显示view
     * @param path 图片地址
     */
    fun showImage(imageView: ImageView, path: String)
    /* fun showImage(imageView: ImageView, path: String,imageLoaderOptions: ImageLoaderOptions)*/
    /**
     * 显示图片
     *
     * @param imageView 图片显示view
     * @param path 图片地址
     * @param placeholderResId 占位图resId
     */
    fun showImage(imageView: ImageView, path: String, @DrawableRes placeholderResId: Int)

    fun showImage(imageView: ImageView, path: String, placeholderResId: Int, failureResId: Int,
                  onSuccessListener: (path: String) -> Unit,
                  onFailListener: (e: Exception?) -> Unit)

    /**
     * 显示图片
     *
     * @param imageView 图片显示view
     * @param path 图片地址
     * @param placeholderResId 占位图resId
     * @param failureResId 加载失败图resId
     */
    fun showImage(imageView: ImageView, path: String, @DrawableRes placeholderResId: Int, @DrawableRes failureResId: Int)

    fun showImageCorner(imageView: ImageView, path: String, @DrawableRes placeholderResId: Int, @DrawableRes failureResId: Int, cornerSize: Int)

    fun showImage(imageView: ImageView, path: String, isGif: Boolean, placeholderResId: Int, failureResId: Int)

    fun clearMemory()
    fun trimMemory(level: Int)

    fun resumeRequests()
    fun pauseRequests()

}